package com.nbsaas.boot.project.rest.convert;

import com.nbsaas.boot.project.data.entity.ProjectFunction;
import com.nbsaas.boot.project.api.domain.response.ProjectFunctionResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* 实体对象转化成响应对象
*/

public class ProjectFunctionResponseConvert  implements Converter<ProjectFunctionResponse,ProjectFunction> {

    @Override
    public ProjectFunctionResponse convert(ProjectFunction source) {
        ProjectFunctionResponse  result = new  ProjectFunctionResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getParent()!=null){
                        result.setParent(source.getParent().getId());
                    }
                    if(source.getParent()!=null){
                        result.setParentName(source.getParent().getName());
                    }
                    if(source.getProjectApp()!=null){
                        result.setProjectApp(source.getProjectApp().getId());
                    }
        return result;
    }

}

